(function($){
    var Login = {
        init:function(){
            this.login();
        },
        login:function(){

            $('#login').click(function(){
                var userName = $('#userName').val();
                var password = $('#password').val();
                if(!userName){
                    layer.msg('账号不能为空！');
                    return false;
                }
                if(!password){
                    layer.msg('密码不能为空！');
                    return false;
                }
                $.ajax({
                    //url:"http://wams.veryeast.cn/activity/8anniversary/day_wampsadmin/login.php?a=loginHandler",
                    url:"http://crazy_second.dev/day_wampsadmin/login.php?a=loginHandler",
                    type:'post',
                    data:{userName:userName,password:password},
                    dataType:'json',
                    success:function(data){
                        if(data.status==1){
                            //window.location.href='http://wams.veryeast.cn/activity/8anniversary/day_wampsadmin/index.php';
                            window.location.href='http://crazy_second.dev/day_wampsadmin/index.php';
                        }else{
                            layer.msg(data.msg);
                        }
                    }
                });
            });
        }
    };
    Login.init();
})(jQuery);